<aside class="sidebar">
  <% @mailers.each do |mailer| %>
    <% next if mailer.total_emails.zero? %>

    <section class="nav_list">
      <h3 class="nav_title"><%= "#{mailer.name.humanize} (#{mailer.total_emails})" %></h3>
      <ul>
        <% uniq_emails(mailer.emails_list).each do |email| %>
          <li>
            <%= link_to maily_email_path(mailer: mailer.name, email: email.name, version: email.version), class: sidebar_class(mailer, email) do %>
              <%= email.name.humanize %>
              <% if email.has_versions? %>
                <%= "(#{email.versions.count} #{'version'.pluralize(email.versions.count)})" %>
              <% end %>
            <% end %>
          </li>
        <% end %>
      </ul>
    </section>
  <% end %>
</aside>
